#ifndef _MAPMANAGER_H_
#define _MAPMANAGER_H_


#include "MapScene.h"
#include "GameEnemy.h"
#include "GameNpc.h"

struct MapHead
{
	fbyte head[6];
	fubyte id1;
	fubyte id2;
	fbyte name[32];

	fubyte x1;
	fubyte x2;
	fubyte y1;
	fubyte y2;
};


class MapManager : public baseSingle< MapManager >
{
public:

	MapManager();
	~MapManager();

	fvoid		LoadMapWarp( const fbyte* path );
	fvoid		LoadMap();

	MapScene*	GetScene( fint32 id );

	fvoid		Update( freal32 delay );

	fvoid		EnterScene( GamePlayer* player );
	fvoid		ExitScene( GamePlayer* player );

	fvoid		JoinTeam( GamePlayer* leader , GamePlayer* player );
	fvoid		LeaveTeam( GamePlayer* player );

	// ChangeMap
	fvoid		AddWaitPlayer( GamePlayer* player );
	fvoid		ChangeMap( freal32 delay );
	fvoid		WarpScene( GamePlayer* player , MapPos& pos );

	fvoid		AddWaitNpc( GameNpc* npc );
	fvoid		UpdateNpc( freal32 delay );


	fvoid		LoadEnemyCount( const fbyte* path );


	GameEnemyCount* GetGameEnemyCount( fint32 id );


protected:
private:



	typedef map< fint32 , GameEnemyCount > GameEnemyCountMap;
	typedef map< fint32 , GameEnemyCount >::iterator GameEnemyCountMapIter;
	GameEnemyCountMap	mGameEnemyCountMap;


	GameNpcList		mWaitNpc;
	GamePlayerList	mWaitPlayers;


	MapSceneVector	mScenes;
	MapSceneMap		mScenesMap;
};

extern MapManager* gMapManager;


#endif


